<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\widgets\webuploader\Files;
$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'class' => 'form-horizontal',
    'validationUrl' => Url::to(['ajax-edit']),
    'fieldConfig' => [
        'template' => "<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>

    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
            <h4 class="modal-title">基本信息</h4>
        </div>
        <div class="modal-body">
            <?= $form->field($model, 'cate_id')->dropDownList($menuDropDownLists)?>
            <?= $form->field($model, 'name')->textInput(); ?>
            <?= $form->field($model, 'position')->textInput(); ?>
            <?= $form->field($model, 'description')->textarea(); ?>
            <?= $form->field($model, 'cover')->widget(Files::class, [
                'type' => 'images',
                'theme' => 'default',
                'themeConfig' => [],
                'config' => [
                    // 可设置自己的上传地址, 不设置则默认地址
                    // 'server' => '',
                    'pick' => [
                        'multiple' => false,
                    ],
                    // 不配置则不生成缩略图
                    'formData' => [
                        // 不配置则不生成缩略图
                        'thumb' => [
                            [
                                'width' => 100,
                                'height' => 100,
                            ],
                            [
                                'width' => 200,
                                'height' => 200,
                            ],
                        ],
                        'drive' => 'local',// 默认本地 支持qiniu/oss/cos 上传
                    ],
                    'chunked' => false,// 开启分片上传
                    'chunkSize' => 512 * 1024,// 分片大小
                ]
            ]); ?>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            <button class="btn btn-primary" type="submit">保存</button>
        </div>
    </div>

<?php ActiveForm::end(); ?>